<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
          var a = prompt("请输入数字A");
        var b = prompt("请输入数字B");
        
        [a,b] = [b,a]
        /* var tmp = a;
        a = b;
        b = tmp; */
        alert("A:" + a + "B:" + b);
        console.log("A:" + a,"B:" + b);
    </script>
</body>
</html>